Add host implementation of Detection parser#1513
Merged
aljazkonec1 merged 42 commits intodevelopfrom Nov 21, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds host-side implementation for the Detection parser to handle parsing of Segmentation head outputs on RVC2 devices where on-device processing is computationally expensive. The implementation introduces utilities for tensor data access and YOLO decoding algorithms (v3, v5, v6, v8, etc.) that can run on the host instead of the device.
Key changes:
- Added
NNDataViewerutility class for safe tensor data access across different storage orders and data types - Implemented multiple YOLO decoding families (R1AF, v3AB, v5AB, TLBR) with support for segmentation and keypoint decoding
- Extended
DetectionParsernode to support host-side execution viasetRunOnHost()API
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/CMakeLists.txt | Expanded test labels to include ondevice and platform-specific tags |
| src/pipeline/utilities/NNDataViewer.hpp | New utility class for accessing tensor data with different storage orders and data types |
| src/pipeline/utilities/DetectionParser/DetectionParserUtils.hpp | Header declaring detection parsing utility functions for various YOLO families |
| src/pipeline/utilities/DetectionParser/DetectionParserUtils.cpp | Implementation of YOLO decoding algorithms, NMS, and segmentation/keypoint processing |
| src/pipeline/node/DetectionParser.cpp | Added host-side run loop and decoder dispatch logic |
| src/pipeline/datatype/ImgDetectionsT.cpp | Added type validation for segmentation mask input |
| include/depthai/pipeline/node/DetectionParser.hpp | Extended node interface to support host execution mode |
| include/depthai/pipeline/datatype/ImgDetectionsT.hpp | Updated documentation for setCvSegmentationMask |
| examples/python/DetectionNetwork/detection_and_segmentation.py | Updated example to conditionally enable host parsing on RVC2 |
| examples/python/DetectionNetwork/detection_and_keypoints.py | Updated model references and camera settings |
| examples/cpp/DetectionNetwork/detection_and_segmentation.cpp | Updated C++ example with RVC2 detection and model selection |
| examples/cpp/DetectionNetwork/detection_and_keypoints.cpp | Updated model reference to nano variant |
| examples/cpp/DetectionNetwork/CMakeLists.txt | Fixed example file paths |
| cmake/Depthai/DepthaiDeviceSideConfig.cmake | Updated device-side binary commit hash |
| bindings/python/src/pipeline/node/DetectionParserBindings.cpp | Added Python bindings for setRunOnHost/runOnHost methods |
| CMakeLists.txt | Added DetectionParserUtils.cpp to build sources |
Comments suppressed due to low confidence (1)
src/pipeline/node/DetectionParser.cpp:1
- Variable
imgSizesSetshould be of typeboolinstead ofuint32_tsince it stores a boolean state. The current type is misleading.
#include "depthai/pipeline/node/DetectionParser.hpp"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This PR adds host side implementation of the updated Detection parser. This is necessary for parsing Segmentation head outputs when using RVC2 due to high computational cost.
Specification
None / not applicable
Dependencies & Potential Impact
None / not applicable
Deployment Plan
None / not applicable
Testing & Validation
The detection_parser_test label expanded with
onhostlabel. Tests passed.